var app = new Vue({
	el: '#app',
	data() {
		return {
			imgList: [
				{
					id: 1,
					imgUrl: './images/candy-shop.jpg',
					imgName: 'candy-shop.jpg'
				},
				{
					id: 2,
					imgUrl: './images/childhood-in-a-picture.jpg',
					imgName: 'childhood-in-a-picture.jpg'
				},
				{
					id: 3,
					imgUrl: './images/contained.jpg',
					imgName: 'contained.jpg'
				},
				{
					id: 4,
					imgUrl: './images/dragon.jpg',
					imgName: 'dragon.jpg'
				},
				{
					id: 5,
					imgUrl: './images/free_hugs.jpg',
					imgName: 'free_hugs.jpg'
				},
				{
					id: 6,
					imgUrl: './images/gravity-falls.png',
					imgName: 'gravity-falls.png'
				},
				{
					id: 7,
					imgUrl: './images/icecreamtruck.png',
					imgName: 'icecreamtruck.png'
				},
				{
					id: 8,
					imgUrl: './images/keyclack.jpg',
					imgName: 'keyclack.jpg'
				},
				{
					id: 9,
					imgUrl: './images/overkill.png',
					imgName: 'overkill.png'
				},
				{
					id: 10,
					imgUrl: './images/say-hello-to-barry.jpg',
					imgName: 'say-hello-to-barry.jpg'
				},
				{
					id: 11,
					imgUrl: './images/space-skull.jpg',
					imgName: 'space-skull.jpg'
				},
				{
					id: 12,
					imgUrl: './images/the-old-fashioned.png',
					imgName: 'the-old-fashioned.png'
				},
				{
					id: 13,
					imgUrl: './images/tornado.jpg',
					imgName: 'tornado.jpg'
				},
				{
					id: 14,
					imgUrl: './images/undo.jpg',
					imgName: 'undo.jpg'
				},
				{
					id: 15,
					imgUrl: './images/white-dragon.jpg',
					imgName: 'white-dragon.jpg'
				}
			]
		};
	},
	methods: {
		copy(name) {
			let link = `https://lxhcool.gitee.io/nice_image/images/${name}`
			let transfer = document.createElement('input');
			document.body.appendChild(transfer);
			transfer.value = link;  // 这里表示想要复制的内容
			transfer.focus();
			transfer.select();
			if (document.execCommand('copy')) {
				document.execCommand('copy');
			}
			transfer.blur();
			document.body.removeChild(transfer);
			layer.msg('复制成功!', { icon: 1 });
		}
	},
});
